# -*- coding:utf-8 -*-
from django_filters import CharFilter
# -*- coding:utf-8 -*-


from django_filters.filterset import FilterSet

from ..models.loginLog import SystemUserLoginInfo


class SystemUserLoginInfoFilter(FilterSet):
    username = CharFilter(lookup_expr='icontains')
    browser = CharFilter(lookup_expr='icontains')
    ipaddr = CharFilter(lookup_expr='icontains')
    device = CharFilter(lookup_expr='icontains')
    loginLocation = CharFilter(lookup_expr='icontains')
    os = CharFilter(lookup_expr='icontains')
    login_type = CharFilter()

    class Meta:
        model = SystemUserLoginInfo
        fields = ['username', 'browser', 'ipaddr', 'device', 'loginLocation', 'os', 'login_type']
        # fields = {
        #     "username": ["contains"],
        #     "browser": ["contains"],
        #     "ipaddr": ["contains"],
        #     "device": ["contains"],
        #     "loginLocation": ["contains"],
        #     "os": ["contains"],
        #     "login_type": ["contains"],
        # }
